<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>
	<script>
		//1.一个参数
		let print1 = function (obj) {
			console.log(obj);
		}
		//简写成：
		let print2 = obj => console.log(obj);
		print2(23);

		//2、多个参数   return可以省略
		let sum1 = function (a, b) {
			return a + b;
		}
		let sum2 = (a, b) => {
			return a + b;
		}
		console.log(sum2(1, 3));
		let sum3 = (a, b) => a + b;
		console.log(sum3(1, 3));

		let person = {
			name: 'zhangsan',
			eat1: function (food) {
				console.log(this.name + '正在吃：' + food);
			},
			//箭头函数
			eat2: food => console.log(person.name + '正在吃：' + food),
			//简写版
			eat3(food) {
				console.log(this.name + '正在吃：' + food);
			}
		}
		person.eat1('aaa');
		person.eat2('bbb');
		person.eat3('ccc');
	</script>
</body>
</html>